home *** CD-ROM | disk | FTP | other *** search
/ 360 Degrees of: Mammoth Cave National Park / 360 Degrees of: Mammoth Cave National Park.iso / pc / data / krpano / krpano.swf / scripts / kprotect.as < prev    next >
Encoding:
Text File  |  2011-01-13  |  7.5 KB  |  236 lines

  1. package
  2. {
  3.    import flash.display.Loader;
  4.    import flash.display.MovieClip;
  5.    import flash.display.Stage;
  6.    import flash.events.Event;
  7.    import flash.events.IOErrorEvent;
  8.    import flash.events.ProgressEvent;
  9.    import flash.system.Capabilities;
  10.    import flash.system.LoaderContext;
  11.    import flash.utils.ByteArray;
  12.    import flash.utils.Dictionary;
  13.    import flash.utils.getDefinitionByName;
  14.    
  15.    public final class kprotect extends MovieClip
  16.    {
  17.       private var _6:Object = null;
  18.       
  19.       private var _8:Loader = null;
  20.       
  21.       private var _9:int = 1;
  22.       
  23.       private var _66:Dictionary = null;
  24.       
  25.       private var _fl:Array = null;
  26.       
  27.       public function kprotect()
  28.       {
  29.          this.embedded_app = kprotect_embedded_app;
  30.          this.embedded_xml = kprotect_embedded_xml;
  31.          this.embedded_filelist = kprotect_embedded_filelist;
  32.          super();
  33.          stop();
  34.          this._6 = new Object();
  35.          this._66 = new Dictionary();
  36.          this._6.completed = false;
  37.          this._6.embeddic = this._66;
  38.          this._3();
  39.          if(stage)
  40.          {
  41.             this.ats();
  42.          }
  43.       }
  44.       
  45.       private function ats(param1:Event = null) : void
  46.       {
  47.          this._4();
  48.          addEventListener(Event.ENTER_FRAME,this.____);
  49.          loaderInfo.addEventListener(ProgressEvent.PROGRESS,this.___);
  50.          loaderInfo.addEventListener(Event.COMPLETE,this.__);
  51.          loaderInfo.addEventListener(IOErrorEvent.IO_ERROR,this._ioerror);
  52.       }
  53.       
  54.       public function embeddedstartup(param1:Stage, param2:Function) : void
  55.       {
  56.          this._6.embedded = true;
  57.          this._6.stage = param1;
  58.          this._6.cb = param2;
  59.          this.ats();
  60.       }
  61.       
  62.       private function _3() : void
  63.       {
  64.          this._6.bytesLoaded = loaderInfo.bytesLoaded;
  65.          this._6.bytesTotal = loaderInfo.bytesTotal;
  66.       }
  67.       
  68.       private function _4(param1:* = null) : void
  69.       {
  70.          var _loc2_:ByteArray = new this.embedded_app() as ByteArray;
  71.          var _loc3_:ByteArray = new this.embedded_xml() as ByteArray;
  72.          var _loc4_:ByteArray = new this.embedded_filelist() as ByteArray;
  73.          if(_loc4_.length > 4)
  74.          {
  75.             this._6.filelist = _loc4_;
  76.          }
  77.          var _loc5_:ByteArray = this._5(_loc2_);
  78.          this._6.data = _loc2_;
  79.          if(_loc3_.length > 4)
  80.          {
  81.             this._6.xml = _loc3_;
  82.          }
  83.          this._8 = new Loader();
  84.          this._8.contentLoaderInfo.addEventListener(Event.COMPLETE,this._0);
  85.          var _loc6_:LoaderContext = null;
  86.          if(Capabilities.playerType == "Desktop")
  87.          {
  88.             _loc6_ = new LoaderContext();
  89.             _loc6_.allowLoadBytesCodeExecution = true;
  90.          }
  91.          this._8.loadBytes(_loc5_,_loc6_);
  92.       }
  93.       
  94.       private function _0(param1:Event) : void
  95.       {
  96.          var _loc2_:* = this._8.content;
  97.          if(stage != null)
  98.          {
  99.             this._6.stage = stage;
  100.             this._6.root = this;
  101.          }
  102.          _loc2_._1(this._6);
  103.       }
  104.       
  105.       private function _5(param1:ByteArray) : ByteArray
  106.       {
  107.          var _loc3_:int = 0;
  108.          var _loc4_:int = 0;
  109.          var _loc5_:* = 0;
  110.          var _loc8_:* = 0;
  111.          var _loc9_:* = 0;
  112.          var _loc10_:int = 0;
  113.          var _loc2_:ByteArray = param1;
  114.          var _loc6_:ByteArray = null;
  115.          var _loc7_:ByteArray = null;
  116.          _loc3_ = int(_loc2_[4]);
  117.          _loc4_ = 256 + ((int(_loc2_[int(_loc3_)]) ^ _loc3_) & 0x0F | ((int(_loc2_[int(2 + _loc3_)]) ^ _loc3_) >> 2 & 0x3F) << 4 | ((int(_loc2_[int(1 + _loc3_)]) ^ _loc3_) >> 1 & 0x3F) << 10 | ((int(_loc2_[int(3 + _loc3_)]) ^ _loc3_) & 0x3F) << 16);
  118.          _loc5_ = (int(_loc2_[int(4 + _loc3_)]) ^ _loc3_) & 0x0F | ((int(_loc2_[int(6 + _loc3_)]) ^ _loc3_) >> 2 & 0x3F) << 4 | ((int(_loc2_[int(5 + _loc3_)]) ^ _loc3_) >> 1 & 0x3F) << 10 | ((int(_loc2_[int(7 + _loc3_)]) ^ _loc3_) & 0x3F) << 16;
  119.          _loc6_ = new ByteArray();
  120.          _loc6_.length = 256;
  121.          _loc10_ = 0;
  122.          while(_loc10_ < 256)
  123.          {
  124.             _loc6_[_loc10_] = _loc2_[_loc10_];
  125.             _loc10_++;
  126.          }
  127.          _loc7_ = new ByteArray();
  128.          _loc7_.length = _loc5_;
  129.          _loc10_ = 0;
  130.          _loc8_ = 0;
  131.          _loc9_ = 0;
  132.          while(_loc10_ < _loc5_)
  133.          {
  134.             _loc8_ = _loc8_ + 1 & 0xFF;
  135.             _loc9_ = _loc9_ + _loc6_[_loc8_] & 0xFF;
  136.             _loc7_[_loc10_] = _loc2_[int(_loc4_ + _loc10_)] ^ _loc6_[int(_loc6_[_loc8_] + _loc6_[_loc9_] & 0xFF)];
  137.             _loc3_ = int(_loc6_[_loc8_]);
  138.             _loc6_[_loc8_] = _loc6_[_loc9_];
  139.             _loc6_[_loc9_] = _loc3_;
  140.             _loc10_++;
  141.          }
  142.          _loc6_ = null;
  143.          return _loc7_;
  144.       }
  145.       
  146.       private function _ioerror(param1:IOErrorEvent) : void
  147.       {
  148.          this._9 = 999999;
  149.       }
  150.       
  151.       private function ___(param1:ProgressEvent) : void
  152.       {
  153.          this._3();
  154.       }
  155.       
  156.       private function __(param1:Event) : void
  157.       {
  158.          loaderInfo.removeEventListener(ProgressEvent.PROGRESS,this.___);
  159.          loaderInfo.removeEventListener(Event.COMPLETE,this.__);
  160.          this._6.completed = true;
  161.       }
  162.       
  163.       private function ____(param1:Event) : void
  164.       {
  165.          if(this._9 >= framesLoaded)
  166.          {
  167.             if(framesLoaded == totalFrames)
  168.             {
  169.                removeEventListener(Event.ENTER_FRAME,this.____);
  170.                this._6.completed = true;
  171.             }
  172.             return;
  173.          }
  174.          ++this._9;
  175.          this._3();
  176.          nextFrame();
  177.          this._____(this._9 - 2);
  178.       }
  179.       
  180.       private function _____(param1:int) : void
  181.       {
  182.          var _loc4_:ByteArray = null;
  183.          var _loc5_:uint = 0;
  184.          var _loc6_:String = null;
  185.          var _loc7_:uint = 0;
  186.          var _loc8_:uint = 0;
  187.          var _loc9_:uint = 0;
  188.          var _loc10_:ByteArray = null;
  189.          var _loc11_:String = null;
  190.          var _loc12_:Array = null;
  191.          var _loc13_:Function = null;
  192.          var _loc2_:String = String(param1);
  193.          while(_loc2_.length < 6)
  194.          {
  195.             _loc2_ = "0" + _loc2_;
  196.          }
  197.          var _loc3_:Class = Class(getDefinitionByName("kprotectdata_dataset" + _loc2_));
  198.          if(_loc3_)
  199.          {
  200.             _loc4_ = new _loc3_() as ByteArray;
  201.             if(_loc4_.length > 1)
  202.             {
  203.                _loc4_.endian = "littleEndian";
  204.                _loc5_ = uint(_loc4_.readShort());
  205.                _loc6_ = _loc4_.readUTFBytes(_loc5_);
  206.                _loc7_ = _loc4_.readUnsignedInt();
  207.                _loc8_ = _loc4_.readUnsignedInt();
  208.                _loc9_ = _loc4_.readUnsignedInt();
  209.                _loc10_ = new ByteArray();
  210.                _loc4_.readBytes(_loc10_);
  211.                _loc11_ = _loc6_;
  212.                if(this._66[_loc11_] == undefined)
  213.                {
  214.                   this._66[_loc11_] = _loc10_;
  215.                }
  216.                else if(this._66[_loc11_] is Function)
  217.                {
  218.                   (this._66[_loc11_] as Function)(_loc10_);
  219.                }
  220.                else if(this._66[_loc11_] is Array)
  221.                {
  222.                   _loc12_ = this._66[_loc11_];
  223.                   this._66[_loc11_] = _loc10_;
  224.                   for each(_loc13_ in _loc12_)
  225.                   {
  226.                      _loc13_(_loc10_);
  227.                   }
  228.                }
  229.             }
  230.             _loc4_ = null;
  231.          }
  232.       }
  233.    }
  234. }
  235.  
  236.